From 629e3c2c7380a0b982b5fef2595e51ff59430536 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 10 Oct 2004 23:28:45 +0000 Subject: [PATCH] Updated the checktrans.php script to be a little more modern and to WFM. Removed the two variations on the theme, since they don't work. Might as well have just one broken script instead of three. --- maintenance/checktrans-enhanced.php | 88 ---------------------- maintenance/checktrans.php | 42 +++-------- maintenance/checktrans2.php | 112 ---------------------------- 3 files changed, 10 insertions(+), 232 deletions(-) delete mode 100644 maintenance/checktrans-enhanced.php delete mode 100755 maintenance/checktrans2.php diff --git a/maintenance/checktrans-enhanced.php b/maintenance/checktrans-enhanced.php deleted file mode 100644 index 2fd481912e..0000000000 --- a/maintenance/checktrans-enhanced.php +++ /dev/null @@ -1,88 +0,0 @@ - $msg ) { - ++$total; - - if ( ! array_key_exists( $code, $$msgarray ) ) { - if (!$arraynameprinted) { - print("\nIn array '$msgarray':\n"); - $arraynameprinted = 1; - } - - print "{$code}\n"; - ++$count; - } - } -} - -if ( ! is_readable( "../LocalSettings.php" ) ) { - print "A copy of your installation's LocalSettings.php\n" . - "must exist in the source directory.\n"; - exit(); -} - -$DP = "../includes"; -require_once( "../LocalSettings.php" ); - -if ( "en" == $wgLanguageCode ) { - print "Current selected language is English. Cannot check translations.\n"; - exit(); -} -$include = "Language" . ucfirst( $wgLanguageCode ) . ".php"; -if ( ! is_readable( "{$IP}/{$include}" ) ) { - print "Translation file \"{$include}\" not found in installation directory.\n" . - "You must have the software installed to run this script.\n"; - exit(); -} - -umask( 000 ); -set_time_limit( 0 ); - -require_once( "{$IP}/Setup.php" ); -$wgTitle = Title::newFromText( "Translation checking script" ); -$wgCommandLineMode = true; - -$count = $total = 0; - - -check("wgLanguageNames"); -check("wgNamespaceNames"); -check("wgDefaultUserOptions"); -check("wgQuickbarSettings"); -check("wgSkinNames"); -check("wgMathNames"); -check("wgUserToggles"); -check("wgWeekdayNames"); -check("wgMonthNames"); -check("wgMonthAbbreviations"); -check("wgValidSpecialPages"); -check("wgSysopSpecialPages"); -check("wgDeveloperSpecialPages"); -check("wgAllMessages"); - -print "{$count} messages of {$total} not translated.\n"; diff --git a/maintenance/checktrans.php b/maintenance/checktrans.php index af8217bd09..172e1e43cc 100644 --- a/maintenance/checktrans.php +++ b/maintenance/checktrans.php @@ -1,51 +1,29 @@ $msg ) { ++$total; - if ( ! array_key_exists( $code, $$msgarray ) ) { - print "{$code}\n"; + print "'{$code}' => \"$msg\",\n"; ++$count; } } + print "{$count} messages of {$total} not translated.\n"; + +?> diff --git a/maintenance/checktrans2.php b/maintenance/checktrans2.php deleted file mode 100755 index c9fb3587d7..0000000000 --- a/maintenance/checktrans2.php +++ /dev/null @@ -1,112 +0,0 @@ - $msg ) { - ++$total; - - if ( ! array_key_exists( $code, $$msgarray ) ) { - if (!$arraynameprinted) { - print("\nIn array '$msgarray':\n"); - $arraynameprinted = 1; - } - - if ( is_numeric( $code ) ) { - print "$code ($msg)\n"; - } else { - print "{$code}\n"; - } - ++$count; - } - } -} - -function getLanguage( $lang ) -{ - $fileName = "../languages/Language" . ucfirst( $lang ) . ".php"; - $file = fopen( $fileName, "r" ); - $text = fread( $file, filesize( $fileName ) ); - $clipPos = strpos( $text, "class Language" ); - $text = substr( $text, 0, $clipPos ); - $text = preg_replace( "/^<\?(php|)/", "", $text ); - $text = preg_replace( "/^include.*$/m", "", $text ); - - return $text; -} - -function checkLanguage( $lang, $enText ) -{ - $text = $enText . getLanguage( $lang ); - check("wgLanguageNames", $lang, $text); - check("wgNamespaceNames", $lang, $text); - check("wgDefaultUserOptions", $lang, $text); - check("wgQuickbarSettings", $lang, $text); - check("wgSkinNames", $lang, $text); - check("wgMathNames", $lang, $text); - check("wgUserToggles", $lang, $text); - check("wgWeekdayNames", $lang, $text); - check("wgMonthNames", $lang, $text); - check("wgMonthAbbreviations", $lang, $text); - check("wgValidSpecialPages", $lang, $text); - check("wgSysopSpecialPages", $lang, $text); - check("wgDeveloperSpecialPages", $lang, $text); - check("wgAllMessages", $lang, $text); - check("wgMagicWords", $lang, $text); -} - -if ( $argc > 1 ) { - array_shift( $argv ); - $glob = implode( " ", $argv ); -} else { - $glob = "../languages/Language?*.php"; -} - -umask( 000 ); -set_time_limit( 0 ); -$count = $total = 0; -$enText = getLanguage( "" ); -$filenames = glob( $glob ); -$width = 80; -foreach ( $filenames as $filename ) { - if ( preg_match( "/languages\/Language(.*)\.php/", $filename, $m ) ) { - $lang = strtolower( $m[1] ); - if ( $lang != "utf8" ) { - print "\n" . str_repeat( "-", $width ); - print "\n$lang\n"; - print str_repeat( "-", $width ) . "\n"; - checkLanguage( $lang, $enText ); - } - } -} - -print "\n" . str_repeat( "-", $width ) . "\n"; -print "{$count} messages of {$total} not translated.\n"; -- 2.20.1